#ifndef CMDAPP_H
#define CMDAPP_H

#include <QObject>

class QProcess;
class QStringList;

class CmdApp : public QObject
{
    Q_OBJECT
public:
    explicit CmdApp(QObject *parent = nullptr);

    void start(QString const& app, QStringList const& args);
    void stop();
signals:
    void progress(QString const& text);
    void error(QString const& error);
    void finished();
private:
    void onError(QString const& error);
     QString errorToText(int errorCode) const;
     void readAllOutput();
private:
    QProcess* process;
};

#endif // CMDAPP_H
